package com.wel.onlineshopping.model;

import com.wel.onlineshopping.repository.ProductRepository;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

@Component
public class DataInitializer implements CommandLineRunner {

    private final ProductRepository productRepository;

    public DataInitializer(ProductRepository productRepository) {
        this.productRepository = productRepository;
    }

    @Override
    public void run(String... args) throws Exception {
        productRepository.save(new Product("iPhone 16", "最新一代智能手机", 5999, "iPhone16.jpg"));
        productRepository.save(new Product("OPPO Find X8", "高性能旗舰手机", 4999, "oppofindx8.png"));
        productRepository.save(new Product("Samsung Galaxy S24", "三星最新旗舰手机", 6999, "Samsung_GALAXYS_24.jpg"));
        productRepository.save(new Product("vivo X200", "超清晰影像手机", 3999, "vivoX200.png"));
        productRepository.save(new Product("nubia Z70 Ultra", "努比亚顶级旗舰", 4599, "nubia Z70 Ultra.jpg"));
        productRepository.save(new Product("Xiaomi 15 Pro", "小米高端旗舰", 5299, "XIAOMI 15PRO.png"));
    }
}
